POV-Ray : Newsgroups : povray.advanced-users : Object Oriented POV code : Re: Object Oriented POV code Server Time
29 Jul 2024 12:20:38 EDT (-0400)
  Re: Object Oriented POV code  
From: Christopher James Huff
Date: 22 Feb 2004 17:09:26
Message: <cjameshuff-CF95A3.17100922022004@news.povray.org>
In article <40391f1d$1@news.povray.org>, "Tek" <tek### [at] evilsuperbraincom> 
wrote:

> > All the coder has to do is look at the types being worked on.
> 
> Which is not as easy as just looking at the name of the function 
> being called. I realise this sounds messy and cumbersome to you, but 
> this "mess" is actually information that we find useful for our 
> application.

I've written a raytracer using vectors that use operator overloading. It 
was much easier to see what the code did than it is in POV, which uses 
macros for the vector operations.


> > And this
> > still isn't an argument against the existance of operator overoading.
> 
> I never said it was!!!

Yes you did...in a reply to one of my earlier messages:

> > I am. I definitely would want operator overloading. I've never seen a
> > good argument against it..."you can make the plus operator multiply" is
> > not a good argument. I can make a "plus()" method that multiplies as
> > well...I can also do a lot of useful things with the ability to use
> > operators with my own types.
> 
> Well, I know a good argument against it. So good in fact that it's the reason
> why every games programmer I know doesn't use operator overloading: It hides
> processing.


> > But it requires more thought about the wrong things...I don't see how it
> > can help.
> 
> For us, these are not the wrong things, these are the things we want people 
> to think about.

If you don't know anything about optimization. You optimize the big 
things first, algorithms and specific bottlenecks. You do the smaller, 
more work for the return items later, if necessary. By forcing more 
focus on every little operation done, you make it more likely that some 
larger problem will go unnoticed, and you make the programmer waste time 
they could be spending doing actually useful optimizations.


> In most OO programming applications you want to free people to
> think at a higher level, we do not. In fact we seldom even use objects and
> inheritance, because we prefer to keep things at a lower level than that.

Frankly, I don't think you understand OO programming. Unless you use 
virtual functions, inheritance has zero overhead. If you have virtual 
functions, overhead is still miniscule. And abstracting things can be of 
great help in creating a tight, efficient module that is still both easy 
to use and understand. And I don't buy your argument about vector-matrix 
multiplication...if you're doing high-performance code, you should 
always be aware of the types you're working with.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.